//
//  UIImage+ImageWaterPrint.m
//  Image
//
//  Created by kang on 2018/7/12.
//  Copyright © 2018年 fuyunhe. All rights reserved.
//

#import "UIImage+ImageWaterPrint.h"

@implementation UIImage (ImageWaterPrint)

-(UIImage *)imageWater:(UIImage *)imageLogo waterString:(NSString *)waterString{
    
    UIGraphicsBeginImageContext(self.size);
    
    [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)];
    
    CGFloat waterX = 600;
    CGFloat waterY = 400;
    CGFloat waterW = 20;
    CGFloat waterH = 20;
    
    [imageLogo drawInRect:CGRectMake(waterX, waterY, waterW, waterH)];
    
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
    paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
    
    NSDictionary *dic = @{NSFontAttributeName : [UIFont systemFontOfSize:20],NSParagraphStyleAttributeName : paragraphStyle,NSForegroundColorAttributeName : [UIColor redColor]};
    
    [waterString drawInRect:CGRectMake(0, 0, 300, 6) withAttributes:dic];
    
    UIImage *imgNew = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();
    
    return imgNew;
    
}

@end
